<template>
  <div class="app-pro-basicLayout-content-wrap">
    <div class="app-pro-pages-content">
      <div class="app-pro-table-search">
        <el-form :inline="true" :model="formInline" ref="formInline" label-width="80px" size="small" class="form-flex-item">
          <el-row :gutter="20">
            <el-col :xs="12" :sm="10" :md="8" :lg="6">
              <el-form-item :label="'검색'|language" prop="keyword">
                <el-input v-model="formInline.keyword" :placeholder="'검색어: 이력서 이름, 지원분야, 전문가 유형,자기소개'|language" @keyup.enter.native="handleSearch"></el-input>
              </el-form-item>
            </el-col>
            <el-col :xs="6" :sm="6" :md="6" :lg="6">
              <el-form-item>
                <el-button type="primary" size="small" @click="handleSearch">{{'검색' | language}}</el-button>
                <el-button size="small" @click="resetForm('formInline')">{{'초기화' | language}}</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div class="app-pro-pages-table">
        <div class="main-card">
          <div class="main-table-toolbar">
            <div class="main-table-toolbar-title">
              <div class="main-table-toolbar-title-only">인재정보 관리</div>
            </div>
            <div class="main-table-toolbar-option">
              <!-- <el-button type="primary" size="mini" icon="el-icon-plus" style="margin-right:5px" @click="confirmAddResume">추가</el-button> -->
              <!--
              <el-divider direction="vertical"></el-divider> -->
              <el-link :underline="false" class="main-table-toolbar-item-icon">
                <el-tooltip class="item" effect="dark" :content="'다운로드'|language" placement="top">
                  <i @click="downloadFile('/api/cv/index', '인재정보 관리')" class="el-icon-download"></i>
                </el-tooltip>
              </el-link>
              <!-- <el-link :underline="false" class="main-table-toolbar-item-icon">
                <el-tooltip class="item" effect="dark" :content="'초기화'|language" placement="top">
                  <i @click="getResumeList()" class="el-icon-refresh-right"></i>
                </el-tooltip>
              </el-link> -->
            </div>
          </div>
          <div class="main-table-wrapper" style="padding: 0">
            <my-table
              :columns="columns"
              :data="data"
              :loading="loading"
              :pagination="pagination"
              :showIndex="true"
              :showSelection="true"
              :cellStyle="{padding: '6px 0'}"
              :headerCellStyle="{background:'rgba(247, 133, 2, 1)',color:'#fff'}"
              @emitSelection="emitSelection"
              @currentChange="currentChange"
              @sortChange="sortChange">
              <template v-slot:status="slotProps">
                <el-tag v-if="slotProps.callback.row.status === 0" effect="dark" size="small">{{'수정중'| language}}</el-tag>
                <el-tag v-else type="success" effect="dark" size="small">{{'작성완료'| language}}</el-tag>
              </template>
              <template v-slot:is_public="slotProps">
                <el-tag v-if="slotProps.callback.row.is_public === 1" effect="dark" size="small">{{'공개'| language}}</el-tag>
                <el-tag v-else type="warning" effect="dark" size="small">{{'비공개'| language}}</el-tag>
              </template>
              <template v-slot:is_important="slotProps">
                <el-tag v-if="slotProps.callback.row.is_important === 0" effect="dark" size="small">{{'아니요'| language}}</el-tag>
                <el-tag v-else type="success" effect="dark" size="small">{{'예'| language}}</el-tag>
              </template>
              <template v-slot:operation="slotProps">
                <el-button
                  @click.native.prevent="handleShow(slotProps.callback.row)"
                  style="color:#666"
                  type="text">
                  {{'조회'| language}}
                </el-button>
                <el-button
                  @click.native.prevent="handleEdit(slotProps.callback.row)"
                  type="text">
                  {{'상태수정'| language}}
                </el-button>
                <el-button
                  @click.native.prevent="handleUpdate(slotProps.callback.row)"
                  type="text">
                  {{'수정'| language}}
                </el-button>
                <el-divider direction="vertical"></el-divider>
                <el-popconfirm
                  title="삭제하시겠습니까"
                  @onConfirm="handleDeleteResume(slotProps.callback.row.id)"
                  :confirmButtonText="'확인'|language"
                  :cancelButtonText="'취소'|language"
                >
                  <el-button
                    slot="reference"
                    type="text"
                    style="color:#f56c6c">
                    {{'삭제'| language}}
                  </el-button>
                </el-popconfirm>
              </template>
            </my-table>
          </div>
        </div>
      </div>
    </div>

    <el-dialog
      :title="dialogForm.title"
      custom-class="dialog-content"
      :visible.sync="dialogForm.dialogVisible"
      :destroy-on-close="true"
      top="5%"
      width="550px">
      <div class="dialog-body-content">
        <form-page
          :ref-obj.sync="formInfo.ref"
          :data="formInfo.data"
          :field-list="formInfo.fieldList"
          :rules="formInfo.rules"
          :label-width="formInfo.labelWidth"
          :list-type-info="listTypeInfo">
        </form-page>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogForm.dialogVisible = false">{{'취소'| language}}</el-button>
        <el-button size="small" type="primary" @click="handleSubmitResume">{{'확인'| language}}</el-button>
      </span>
    </el-dialog>
    <el-dialog
      :title="dialogDetail.title"
      custom-class="dialog-content"
      :visible.sync="dialogDetail.dialogVisible"
      :destroy-on-close="true"
      top="5%"
      width="900px">
      <div class="dialog-body-content">
        <div class="resume-detail-template">
          <div><label>{{'공개'|language}}：</label><span>{{dialogDetail.detailData.is_public===1?'공개':'비공개' | language}}</span></div>
          <div><label>{{'상태'|language}}：</label><span>{{dialogDetail.detailData.status===1?'작성완료':'작성중' | language}}</span></div>
          <div><label>{{'주요인재'|language}}：</label><span>{{dialogDetail.detailData.is_important===1?'예':'아니요' | language}}</span></div>
          <div><label>{{'이력서이름'|language}}：</label><span>{{dialogDetail.detailData.title}}</span> </div>
          <div><label>{{'지원분야'|language}}：</label><span>{{dialogDetail.detailData.application_scope}}</span> </div>
          <div><label>{{'전문가 유형'|language}}：</label><span>{{dialogDetail.detailData.experts_type}}</span> </div>
          <div><label>ppt：</label><span>{{dialogDetail.detailData.PPT_grade}}</span> </div>
          <div><label>excel：</label><span>{{dialogDetail.detailData.Excel_grade}}</span> </div>
          <div><label>word：</label><span>{{dialogDetail.detailData.Word_grade}}</span> </div>
          <div><label>HWP：</label><span>{{dialogDetail.detailData.HWP_grade}}</span> </div>
        </div>
        <el-divider></el-divider>
        <div class="resume-detail-template">
          <div style="width:100%">
            <label>{{'경력'|language}}：</label>
            <div style="padding-top:10px" v-for="experience in dialogDetail.detailData.has_many_experience" :key="experience.id">
              <span>{{'기업명'|language}}：{{experience.company}}</span>
              <span>{{'팀명'|language}}：{{experience.department }}</span>
              <span>{{'경력내용'|language}}：{{experience.job_content}}</span>
              <span>{{'직책'|language}}：{{experience.duty}}</span>
              <span>{{'근무기간'|language}}：{{experience.start_at + ' - ' + experience.end_at}}</span>
            </div>
          </div>
        </div>
        <el-divider></el-divider>
        <div class="resume-detail-template">
          <div>
            <label>{{'자격증'|language}}：</label>
            <div style="padding-top:10px" v-for="certified in dialogDetail.detailData.has_many_certified" :key="certified.id">
              <span>{{'자격증 이름'|language}}：{{certified.certified}}</span>
              <span>{{'증서발급 기구'|language}}：{{certified.issued_by }}</span>
              <span>{{'시간 가져오기'|language}}：{{certified.get_at}}</span>
            </div>
          </div>
          <div>
            <label>{{'학력'|language}}：</label>
            <div style="padding-top:10px" v-for="education in dialogDetail.detailData.has_many_education" :key="education.id">
              <span>{{'상태'|language}}：{{education.status === 0 ?'추가완료':'진행중'}}</span>
              <span>{{'졸업년월'|language}}：{{education.end_at}}</span>
              <span>{{'전공명'|language}}：{{education.specialities}}</span>
              <span>{{'학교명'|language}}：{{education.school}}</span>
            </div>
          </div>
        </div>
        <el-divider></el-divider>
        <div class="resume-detail-template">
          <div>
            <label>{{'핵심역량'|language}}：</label>
            <div style="padding-top:10px" v-for="skill in dialogDetail.detailData.has_many_skill" :key="skill.id">
              <span>{{'핵심역량'|language}}：{{skill.skill}}</span><br>
              <span>{{'경력'|language}}：{{skill.experience}}</span>
            </div>
          </div>
          <div>
            <label>{{'학교명'|language}}：</label>
            <div style="padding-top:10px" v-for="train in dialogDetail.detailData.has_many_train" :key="train.id">
              <span>{{'교육내용'|language}}：{{train.training}}</span><br>
              <span>{{'교육기관'|language}}：{{train.training_organization}}</span><br>
              <span>{{'기간'|language}}：{{train.start_at + ' - ' + train.end_at}}</span>
            </div>
          </div>
        </div>
        <el-divider></el-divider>
        <div class="resume-detail-template">
          <div style="width:100%"><label>{{'자기소개'|language}}：</label><div v-html="dialogDetail.detailData.introduce"></div> </div>
        </div>
      </div>
    </el-dialog>

    <el-dialog
      :title="dialogUpdateForm.title"
      custom-class="dialog-content"
      :visible.sync="dialogUpdateForm.dialogVisible"
      :destroy-on-close="true"
      top="5%"
      width="1000px">
      <div class="dialog-body-content">
        <form-page
          :ref-obj.sync="updateFormInfo.ref"
          :data="updateFormInfo.data"
          :field-list="updateFormInfo.fieldList"
          :rules="updateFormInfo.rules"
          :label-width="updateFormInfo.labelWidth"
          :list-type-info="listTypeInfo">
          <template v-slot:form-item-has_many_certified >
            <div>
              <div v-for="(item,index) in updateFormInfo.data.has_many_certified" :key="index" style="margin-bottom:10px">
                <el-input v-model="item.certified" style="width:200px" placeholder="수상명"></el-input>
                <el-input v-model="item.issued_by" style="width:200px;margin-left:10px" placeholder="수여기관"></el-input>
                <el-date-picker value-format="yyyy-MM-dd" v-model="item.get_at" style="width:150px;margin-left:10px" placeholder="수상녕도"></el-date-picker>
                <el-button @click="updateFormInfo.data.has_many_certified.splice(index,1)" style="margin-left:10px">삭제</el-button>
              </div>
              <el-button icon="el-icon-plus" @click="updateFormInfo.data.has_many_certified.push({certified:'',issued_by:'',get_at:''})">추가</el-button>
            </div>
          </template>
          <template v-slot:form-item-has_many_education >
            <div>
              <div v-for="(item,index) in updateFormInfo.data.has_many_education" :key="index" style="margin-bottom:10px">
                <el-select v-model="item.status" style="width:150px;">
                  <el-option :value="0" label="종료 시간"></el-option>
                  <el-option :value="1" label="노출중"></el-option>
                </el-select>
                <el-date-picker value-format="yyyy-MM-dd" v-model="item.end_at" style="width:150px;margin-left:10px" placeholder="졸업년월"></el-date-picker>
                <el-input v-model="item.specialities" style="width:150px;margin-left:10px" placeholder="전공명"></el-input>
                <el-input v-model="item.school" style="width:150px;margin-left:10px" placeholder="학교명"></el-input>
                <el-button @click="updateFormInfo.data.has_many_education.splice(index,1)" style="margin-left:10px">삭제</el-button>
              </div>
              <el-button icon="el-icon-plus" @click="updateFormInfo.data.has_many_education.push({status:'',end_at:'',specialities:'',school:''})">추가</el-button>
            </div>
          </template>
          <template v-slot:form-item-has_many_experience >
            <div>
              <div v-for="(item,index) in updateFormInfo.data.has_many_experience" :key="index" style="margin-bottom:10px">
                <el-input v-model="item.company" style="width:150px;margin-bottom:5px" placeholder="기업명"></el-input>
                <el-input v-model="item.department" style="width:150px;margin-left:10px;margin-bottom:5px" placeholder="팀명"></el-input>
                <el-date-picker value-format="yyyy-MM-dd" v-model="item.start_at" style="width:150px;margin-left:10px;margin-bottom:5px" placeholder="시작 시간"></el-date-picker>
                <el-date-picker value-format="yyyy-MM-dd" v-model="item.end_at" style="width:150px;margin-left:10px;margin-bottom:5px" placeholder="종료 시간"></el-date-picker>
                <el-input v-model="item.duty" style="width:150px;margin-bottom:5px" placeholder="직책"></el-input>
                <el-input v-model="item.job_content" style="width:300px;margin-left:10px;margin-bottom:5px" placeholder="경력내용"></el-input>
                <el-button @click="updateFormInfo.data.has_many_experience.splice(index,1)" style="margin-left:10px">삭제</el-button>
              </div>
              <el-button icon="el-icon-plus" @click="updateFormInfo.data.has_many_experience.push({company:'',department:'',start_at:'',end_at:'',duty:'',job_content:''})">추가</el-button>
            </div>
          </template>
          <template v-slot:form-item-has_many_skill >
            <div>
              <div v-for="(item,index) in updateFormInfo.data.has_many_skill" :key="index" style="margin-bottom:10px">
                <el-input v-model="item.skill" style="width:200px;" placeholder="핵심역량"></el-input>
                <el-input v-model="item.experience" style="width:300px;margin-left:10px;margin-bottom:5px" placeholder="경력"></el-input>
                <el-button @click="updateFormInfo.data.has_many_skill.splice(index,1)" style="margin-left:10px">삭제</el-button>
              </div>
              <el-button icon="el-icon-plus" @click="updateFormInfo.data.has_many_skill.push({skill:'',experience:''})">추가</el-button>
            </div>
          </template>
          <template v-slot:form-item-has_many_train >
            <div>
              <div v-for="(item,index) in updateFormInfo.data.has_many_train" :key="index" style="margin-bottom:10px">
                <el-input v-model="item.training" style="width:150px;margin-bottom:5px" placeholder="교육내용"></el-input>
                <el-input v-model="item.training_organization" style="width:150px;margin-left:10px;margin-bottom:5px" placeholder="교육기관"></el-input>
                <el-date-picker value-format="yyyy-MM-dd" v-model="item.start_at" style="width:150px;margin-left:10px;margin-bottom:5px" placeholder="시작 시간"></el-date-picker>
                <el-date-picker value-format="yyyy-MM-dd" v-model="item.end_at" style="width:150px;margin-left:10px;margin-bottom:5px" placeholder="종료 시간"></el-date-picker>
                <el-button @click="updateFormInfo.data.has_many_train.splice(index,1)" style="margin-left:10px">삭제</el-button>
              </div>
              <el-button icon="el-icon-plus" @click="updateFormInfo.data.has_many_train.push({training:'',training_organization:'',start_at:'',end_at:''})">추가</el-button>
            </div>
          </template>
          <template v-slot:form-item-has_many_job >
            <div>
              <div v-for="(item,index) in updateFormInfo.data.has_many_job" :key="index" style="margin-bottom:10px">
                <el-cascader v-model="item.job_id" :options="hasManyJobOption" style="width:500px;" clearable filterable></el-cascader>
                <el-button @click="updateFormInfo.data.has_many_job.splice(index,1)" style="margin-left:10px">삭제</el-button>
              </div>
              <el-button icon="el-icon-plus" @click="updateFormInfo.data.has_many_job.push({job1_id:[]})">추가</el-button>
            </div>
          </template>
          <template v-slot:form-item-introduce >
            <Summernote :noteContent="noteContent"></Summernote>
          </template>
        </form-page>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogUpdateForm.dialogVisible = false">{{'취소'| language}}</el-button>
        <el-button size="small" type="primary" @click="handleUpdateResume">{{'확인'| language}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { publicEvents } from '@/mixins'
import { mergeObjOfValue, deepClone, changeOption } from '@/utils'
import FormPage from '_c/FormPage'
import myTable from '_c/Table'
import * as resumeApi from '@/api/resume/index'
import * as roleApi from '@/api/setting/role'
import { getJobIndex } from '@/api/app'
import Summernote from '_c/Summernote'
const formInfoData = {
  id: '',
  is_public: '',
  is_important: ''
}
const updateFormData = {
  id: '',
  title: '',
  is_public: '',
  has_many_certified: [],
  has_many_education: [],
  has_many_experience: [],
  has_many_skill: [],
  has_many_train: [],
  has_many_job: [],
  application_scope: '',
  experts_type: '',
  introduce: '',
  PPT_grade: '',
  Word_grade: '',
  HWP_grade: '',
  keywords: ''
}
export default {
  name: 'resume',
  data () {
    return {
      formInline: {
        keyword: ''
      },
      options: [],
      columns: [
        {
          label: '상태',
          prop: '',
          width: 80,
          slot: 'status',
          sortable: true
        }, {
          label: '공개',
          prop: 'is_public',
          width: 95,
          slot: 'is_public',
          sortable: true
        }, {
          label: '주요인재',
          prop: 'is_important',
          width: 100,
          slot: 'is_important',
          sortable: true
        }, {
          label: '이력서이름',
          prop: 'title',
          sortable: true,
          align: 'left'
        }, {
          label: '지원분야',
          prop: 'application_scope',
          sortable: true,
          align: 'left'
        }, {
          label: '전문가 유형',
          prop: 'experts_type',
          sortable: true,
          align: 'left'
        },
        // {
        //   label: 'ppt',
        //   prop: 'PPT_grade'
        // }, {
        //   label: 'excel',
        //   prop: 'Excel_grade'
        // }, {
        //   label: 'word',
        //   prop: 'Word_grade'
        // }, {
        //   label: 'HWP',
        //   prop: 'HWP_grade'
        // },
        {
          label: '관리',
          prop: '',
          width: 220,
          align: 'left',
          slot: 'operation'
        }
      ],
      data: [],
      pagination: {
        currentPage: 1,
        pageSize: 15
      },
      selectionData: [],
      loading: true,
      dialogForm: {
        dialogVisible: false,
        title: '신규등록'
      },
      dialogDetail: {
        dialogVisible: false,
        title: '이력서 내용',
        detailData: {}
      },
      dialogUpdateForm: {
        dialogVisible: false,
        title: '수정'
      },
      listTypeInfo: {
        is_public: [{
          label: '공개',
          value: 1
        }, {
          label: '비공개',
          value: 0
        }],
        status: [{
          label: '수정완료',
          value: 1
        }, {
          label: '수정중',
          value: 0
        }],
        is_important: [{
          label: '예',
          value: 1
        }, {
          label: '아니요',
          value: 0
        }],
        experts_type: []
      },
      formInfo: {
        ref: null,
        data: formInfoData,
        fieldList: [
          { label: '공개', value: 'is_public', width: '260', type: 'radio', list: 'is_public', className: 'el-form-block' },
          { label: '주요인재', value: 'is_important', width: '260', type: 'radio', list: 'is_important', className: 'el-form-block' }
        ],
        rules: {},
        labelWidth: '150px'
      },
      updateFormInfo: {
        ref: null,
        data: updateFormData,
        fieldList: [
          { label: '공개', value: 'is_public', width: '260', type: 'radio', list: 'is_public', className: 'el-form-block' },
          { label: '주요인재', value: 'status', width: '260', type: 'radio', list: 'status', className: 'el-form-block' },
          { label: '자격증', value: 'has_many_certified', slot: true, className: 'el-form-block' },
          { label: '학력', value: 'has_many_education', slot: true, className: 'el-form-block' },
          { label: '근무경력', value: 'has_many_experience', slot: true, className: 'el-form-block' },
          { label: '핵심역량', value: 'has_many_skill', slot: true, className: 'el-form-block' },
          { label: '학교명', value: 'has_many_train', slot: true, className: 'el-form-block' },
          { label: '경력내용', value: 'has_many_job', slot: true, className: 'el-form-block' },
          { label: '지원분야', value: 'application_scope', type: 'input', className: 'el-form-block' },
          { label: '전문가 유형', value: 'experts_type', type: 'input', className: 'el-form-block' },
          { label: 'PPT', value: 'PPT_grade', width: '260', type: 'inputNumber', className: 'el-form-block' },
          { label: 'Word', value: 'Word_grade', width: '260', type: 'inputNumber', className: 'el-form-block' },
          { label: 'HWP', value: 'HWP_grade', width: '260', type: 'inputNumber', className: 'el-form-block' },
          { label: '빠른검색', value: 'keywords', width: '260', type: 'input', className: 'el-form-block' },
          { label: '자기소개', value: 'introduce', slot: true, className: 'el-form-block' }
        ],
        rules: {},
        labelWidth: '100px'
      },
      hasManyJobOption: [],
      sortParams: {},
      noteContent: ''
    }
  },
  mixins: [publicEvents],
  components: {
    myTable,
    FormPage,
    Summernote
  },
  mounted () {
    this.formInfo.data = deepClone(formInfoData)
    this.updateFormInfo.data = deepClone(updateFormData)
    this.getResumeList()
    this.getHasManyJobOption()
    this.getRoleList()
    this.initRules()
  },
  methods: {
    initRules () {
      const formInfo = this.formInfo
      formInfo.rules = this.$initRules(formInfo.fieldList)
    },
    getRoleList () {
      roleApi.getRoleList().then(res => {
        this.options = this.listTypeInfo.role_id = res.map(item => {
          return {
            value: item.id,
            label: item.name
          }
        })
      })
    },
    getHasManyJobOption () {
      getJobIndex().then(res => {
        this.hasManyJobOption = changeOption(res, { value: 'id', label: 'name' })
      })
    },
    getResumeList () {
      const data = {
        ...this.formInline,
        ...this.sortParams,
        page: this.pagination.currentPage,
        per: this.pagination.pageSize
      }
      this.loading = true
      resumeApi.getResumeList(data).then(res => {
        this.loading = false
        this.data = res.data
        this.pagination.total = res.meta.pagination.total
      }).catch(() => {
        this.loading = false
      })
    },
    sortChange (val) {
      this.pagination.currentPage = 1
      if (val.order === 'ascending') {
        this.sortParams = {
          sort: 'asc',
          order_by: val.prop
        }
      } else if (val.order === 'descending') {
        this.sortParams = {
          sort: 'desc',
          order_by: val.prop
        }
      } else {
        this.sortParams = {}
      }
      this.getResumeList()
    },
    handleDeleteResume (id) {
      resumeApi.deleteResume({ id }).then(res => {
        this.$message({
          message: '삭제되였습니다.',
          type: 'success'
        })
        this.getResumeList()
      })
    },
    confirmAddResume () {
      this.noteContent = ''
      this.dialogForm.title = '신규등록'
      mergeObjOfValue(this.formInfo.data, formInfoData)
      this.dialogForm.dialogVisible = true
    },
    handleSubmitResume () {
      if (this.formInfo.data.id) {
        resumeApi.updateResumeStatus(this.formInfo.data).then(res => {
          this.$message({
            message: '수정되였습니다.',
            type: 'success'
          })
          this.getResumeList()
          this.dialogForm.dialogVisible = false
        })
      }
    },
    handleEdit (rowData) {
      this.dialogForm.title = '이력서 상태 수정하기'
      this.formInfo.data.id = rowData.id
      mergeObjOfValue(this.formInfo.data, rowData)
      this.dialogForm.dialogVisible = true
    },
    handleShow (rowData) {
      this.dialogDetail.dialogVisible = true
      resumeApi.getResumeDetail({ id: rowData.id }).then(res => {
        this.dialogDetail.detailData = res
      })
    },
    handleUpdate (rowData) {
      this.noteContent = rowData.introduce
      this.formInfo.data.id = rowData.id
      mergeObjOfValue(this.updateFormInfo.data, rowData)
      this.dialogUpdateForm.dialogVisible = true
    },
    handleUpdateResume () {
      const obj = {
        ...this.updateFormInfo.data
      }
      // eslint-disable-next-line
      obj.introduce = $('#summernote').summernote('code')
      for (var prop in obj) {
        if (obj[prop] instanceof Object) {
          if (obj[prop].length) {
            const copyProp = []
            obj[prop].forEach((element, index) => {
              const allval = Object.values(element)
              const isEmpty = allval.every(e => e !== '' && e.length !== 0)
              if (isEmpty) {
                copyProp.push(obj[prop][index])
              }
            })
            obj[prop] = copyProp
          }
          obj[prop] = JSON.stringify(obj[prop])
        }
      }
      console.log(obj)
      resumeApi.saveResume(obj).then(res => {
        this.getResumeList()
        this.dialogUpdateForm.dialogVisible = false
      })
    },
    handleSearch () {
      this.pagination.currentPage = 1
      this.getResumeList()
    },
    resetForm (formName) {
      this.$refs[formName].resetFields()
      this.getResumeList()
    },
    emitSelection (val) {
      this.selectionData = val
    },
    currentChange (val) {
      this.pagination.currentPage = val
      this.getResumeList()
    }
  }
}
</script>
